using System.Data;

namespace DataScripter.Scripting.Compare.DataTables.Structure
{
    internal class DataColumnStructureComparer
    {
        private DataColumn Column1 { get; set; }
        private DataColumn Column2 { get; set; }

        public DataColumnStructureComparer(DataColumn column1, DataColumn column2)
        {
            Column1 = column1;
            Column2 = column2;
        }

        public DataColumnStructureComparisonResult Compare()
        {
            DataColumnStructureComparisonResult result = new DataColumnStructureComparisonResult();
            if (Column1.ColumnName != Column2.ColumnName)
                result.Differences.Add("Name");
            if (Column1.DataType != Column2.DataType)
                result.Differences.Add("DataType");
            if (Column1.AllowDBNull != Column2.AllowDBNull)
                result.Differences.Add("AllowDBNull");
            if (Column1.MaxLength != Column2.MaxLength)
                result.Differences.Add("MaxLength");
            if (Column1.Ordinal != Column2.Ordinal)
                result.Differences.Add("Ordinal");
            //if (Column1.Unique != Column2.Unique)
            //    result.Differences.Add("Unique");
            return result;
        }
    }
}